package com.freedom.start.common.base;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @Author: zhenggang.liu
 * @Date: 2019/12/27 19:02
 */
public class BaseCrudEntity implements Serializable {

    private static final long serialVersionUID = -1979068601724235804L;

    public BaseCrudEntity() {
       /* HttpSession session = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getSession();
        String userId = (String) session.getAttribute("userId");
        this.currentUserId = userId;*/
    }

    /**
     * 实体编号（唯一标识）
     */
    protected String id;


    /**
     * 分页对象
     */
    // protected Page<T> page;

    /**
     * 创建人
     */
    protected String createBy;
    /**
     * 创建日期
     */
    protected LocalDateTime createDate;
    /**
     * 更新人
     */
    protected String updateBy;
    /**
     * 更新日期
     */
    protected LocalDateTime updateDate;

    protected String orderBy;

    /**
     * 辅助字段
     */
    protected Date createDateStart;
    protected Date createDateEnd;
    protected Date updateDateStart;
    protected Date updateDateEnd;


    protected String currentUserId;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public LocalDateTime getCreateDate() {
        return createDate;
    }

    public void setCreateDate(LocalDateTime createDate) {
        this.createDate = createDate;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public LocalDateTime getUpdateDate() {
        return updateDate;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public void setUpdateDate(LocalDateTime updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDateStart() {
        return createDateStart;
    }

    public void setCreateDateStart(Date createDateStart) {
        this.createDateStart = createDateStart;
    }

    public Date getCreateDateEnd() {
        return createDateEnd;
    }

    public void setCreateDateEnd(Date createDateEnd) {
        this.createDateEnd = createDateEnd;
    }

    public Date getUpdateDateStart() {
        return updateDateStart;
    }

    public void setUpdateDateStart(Date updateDateStart) {
        this.updateDateStart = updateDateStart;
    }

    public Date getUpdateDateEnd() {
        return updateDateEnd;
    }

    public void setUpdateDateEnd(Date updateDateEnd) {
        this.updateDateEnd = updateDateEnd;
    }

    public String getCurrentUserId() {
        return this.currentUserId;
    }

    public void setCurrentUserId(String currentUserId) {
        this.currentUserId = currentUserId;
    }
}
